package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.entity.NursingProject;
import com.zzyl.vo.NursingProjectVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface NursingProjectMapper {
    /**
     * 分页条件查询
     * @param name
     * @param status
     * @return
     */
    Page<NursingProjectVo> getByPage(String name, Integer status);

    /**
     * 新增
     * @param nursingProject
     */
    @Insert("insert into nursing_project(name,order_no,unit,price,image,nursing_requirement,status,remark,create_time,update_time,create_by,update_by)" +
            "values (#{name},#{orderNo},#{unit},#{price},#{image},#{nursingRequirement},#{status},#{remark},#{createTime},#{updateTime},#{createBy},#{updateBy})")
    void insertNursingProject(NursingProject nursingProject);

    /**
     * 根据id查询护理
     * @param id
     * @return
     */
    @Select("select * from nursing_project where id=#{id}")
    NursingProject getById(Long id);

    /**
     * 修改
     * @param nursingProject
     */
    void updateNursingProject(NursingProject nursingProject);

    /**
     * 启用禁用
     * @param id
     * @param status
     */
    void updateStatus(Long id, Integer status);

    /**
     * 删除
     * @param id
     */
    @Delete("delete from nursing_project where id=#{id}")
    void deleteNursingProject(Long id);

    /**
     * 查询所有护理项目
     * @return
     */
    @Select("select * from nursing_project")
    List<NursingProjectVo> selectAllNursingProject();
}
